from django.db import models
from django.utils import timezone
from common.db import DbModel

# Create your models here.


class HomePage(models.Model):
    """主页模型"""
    image = models.ImageField(verbose_name='轮播图图片')
    description = models.CharField(max_length=255, verbose_name='描述名称')
    activity_intro = models.TextField(verbose_name='活动介绍', blank=True, null=True)
    display_order = models.PositiveIntegerField(default=0, verbose_name='轮播图顺序')

    class Meta:
        db_table = 'homepage_banners'
        verbose_name = '主页轮播图'
        verbose_name_plural = '主页轮播图'
        ordering = ['display_order']  # 按轮播图顺序排序

    def __str__(self):
        return f'{self.description} - {self.display_order}'